This first edition was written for Lua 5.0. While still largely relevant for later versions, there are some differences.
The fourth edition targets Lua 5.3 and is available at Amazon and other bookstores.
By buying the book, you also help to support the Lua project.
3.4 – Concatenation
Lua denotes the string concatenation operator
by "..
" (two dots).
If any of its operands is a number,
Lua converts that number to a string.
print("Hello " .. "World") --> Hello World
print(0 .. 1) --> 01
Remember that strings in Lua are immutable values.
The concatenation operator always creates a new string,
without any modification to its operands:
a = "Hello"
print(a .. " World") --> Hello World
print(a) --> Hello
Copyright © 2003–2004 Roberto Ierusalimschy. All rights reserved.
|
|